package com.hopool.shop.dao.product;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.Projections;

import com.hopool.shop.dao.BaseDao;
import com.hopool.shop.product.Product;

public class ProductDao extends BaseDao{
/*	
	@SuppressWarnings("unchecked")
	public List page(Object exampleobj,Integer firstResult,
			Integer maxResult,String orderType,String... customProperties){
		Example example = 
			Example.create(exampleobj)
				   .excludeZeroes()           //exclude zero valued properties
//				   .excludeProperty("color")  //exclude the property named "color"
				   .ignoreCase()              //perform case insensitive string comparisons
				   .enableLike(); 
		List ps = 
			getSession().createCriteria(exampleobj.getClass()).add(example)
//				.createCriteria("productType").add(Example.create(exampleProduct.getProductType()))
				.setFirstResult(firstResult).setMaxResults(maxResult).list();
		return ps;
	}
	
	public Integer count(Object exampleobj,String... customProperties){
		Example example = 
			Example.create(exampleobj)
				   .excludeZeroes()           //exclude zero valued properties
//				   .excludeProperty("color")  //exclude the property named "color"
				   .ignoreCase()              //perform case insensitive string comparisons
				   .enableLike(); 
		return (Integer) getSession().createCriteria(exampleobj.getClass())
				.setProjection(Projections.countDistinct("id"))
				.add(example).uniqueResult();
	}
	*/
	
	
}
